package com.itheima.method;

public class MethodDemo1 {
    public static void main(String[] args) {
        String code = getCode(4);
        System.out.println(code);
    }

    //定义一个方法，获取一个指定位数的纯数字验证码返回
    public static String getCode(int n) {
        String code = "";
        for (int i = 0; i < n; i++) {
            int num = (int)(Math.random() * 10);
            code = code + num;
        }
        return code;
    }
}
